<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUnitOrderTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('unit_order', function (Blueprint $table) {
            $table->increments('id')->unsigned();
            $table->integer('user_id')->unsigned();
            $table->integer('order_id')->unsigned();
            $table->float('price');
            $table->integer('state')->default(0);
            $table->string('batchcode');
            $table->integer('pay_code')->unsigned()->nullable();
            $table->string('pay_batchcode')->nullable();
            $table->integer('payment_status')->unsigned()->default(0);
            $table->dateTime('payment_time')->nullable();
            $table->dateTime('refund_time')->nullable();
            $table->dateTime('create_time')->nullable();
            $table->dateTime('update_time')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('unit_order');
    }
}
